//斐波那契数
//测试链接：https://leetcode.cn/problems/fibonacci-number/
public class Fib {
    int[] nums = new int[31];
    public int fib(int n) {
        nums[0] = 0; nums[1] = 1;
        if(n < 2) return nums[n];

        for(int i = 2; i <= n; i++) {
            nums[i] = nums[i-1] + nums[i-2];
        }
        return nums[n];
    }
}
